/**
 * Project Name:gc_sms_mvn
 * File Name:LoginLogDaoImpl.java
 * Package Name:com.clps.dev.sms.dao.log.impl
 * @date 2018-12-11 11:17:20 
 * Copyright (c) 2018, jackie.duan@clpsglobal.com All Rights Reserved.
 *
 */
package com.clps.dev.sms.dao.log.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.clps.dev.sms.common.dao.impl.BaseDaoImpl;
import com.clps.dev.sms.dao.log.LoginLogDao;
import com.clps.dev.sms.entity.log.LoginLog;

/**
 * ClassName: LoginLogDaoImpl 
 * @description
 * @date 2018-12-11 11:17:20 
 *
 * @author jackie.duan
 * @version V1.0
 * @since JDK 1.8
 */
@Repository
public class LoginLogDaoImpl extends BaseDaoImpl<LoginLog> implements LoginLogDao{

	private static final String HQL_QUERY_LOGIN_NAME = "from LoginLog where accountName =:accountName";
	/**
	 * Creates a new instance of LoginLogDaoImpl.
	 *
	 * @param clazz
	 */
	
	public LoginLogDaoImpl() {
		super(LoginLog.class);

	}

	/**
	 * @see com.clps.dev.sms.dao.log.LoginLogDao#queryLoginLogAccount(java.lang.Integer)
	 */
	@SuppressWarnings("unchecked")
	@Override
	public LoginLog queryLoginLog(String accountName) {
		
		
		List<LoginLog> list = (List<LoginLog>) this.getHibernateTemplate().findByNamedParam(HQL_QUERY_LOGIN_NAME,"accountName",accountName);
		if(list.size() > 0) {
			LoginLog loginLog = null;
			for (LoginLog loginLog2 : list) {
				loginLog = loginLog2;
			}
			return loginLog;
		}else {
			return null;
		}
	}

}
